package com.dudao.modules.course.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dudao.common.constant.Constant;
import com.dudao.common.page.PageData;
import com.dudao.common.service.impl.CrudServiceImpl;
import com.dudao.common.utils.ConvertUtils;
import com.dudao.modules.course.dao.DudaoArrangeDao;
import com.dudao.modules.course.dto.CourseInitialDTO;
import com.dudao.modules.course.dto.DudaoArrangeDTO;
import com.dudao.modules.course.entity.CourseInitialEntity;
import com.dudao.modules.course.entity.DudaoArrangeEntity;
import com.dudao.modules.course.service.DudaoArrangeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 *
 *
 * @author Lii juliip@163.com
 * @since 1.0.0 2022-12-14
 */
@Service
public class DudaoArrangeServiceImpl extends CrudServiceImpl<DudaoArrangeDao, DudaoArrangeEntity, DudaoArrangeDTO> implements DudaoArrangeService {

    @Autowired
    private DudaoArrangeDao dudaoArrangeDao;

    @Override
    public QueryWrapper<DudaoArrangeEntity> getWrapper(Map<String, Object> params){
        String courseName = (String)params.get("courseName");
        String courseTeacher = (String) params.get("courseTeacher");
        QueryWrapper<DudaoArrangeEntity> wrapper = new QueryWrapper<>();
        wrapper.like(StringUtils.isNotBlank(courseName), "course_name", courseName)
                .like(StringUtils.isNotBlank(courseTeacher), "course_teacher", courseTeacher);

        return wrapper;
    }


    @Override
    public String findDudaoById(String teacherId) {
        return dudaoArrangeDao.findById(teacherId);
    }
}
